package com.victor.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.victor.dao.CityDao;
import com.victor.entity.city.CityIntroduce;
import com.victor.entity.city.CityIntroduceComment;
import com.victor.entity.city.CityIntroduceCommentPhoto;
import com.victor.entity.city.CityIntroduceCommentPraise;
import com.victor.entity.city.CityIntroduceCommentReply;
import com.victor.entity.city.CityIntroducePhoto;
import com.victor.entity.city.CityIntroducePraise;
import com.victor.service.CityService;

@Service
public class CityServiceImpl implements CityService {

	@Autowired
	private CityDao cityDao;

	/**
	 * 传入城市名称，获取城市介绍
	 */
	@Override
	public CityIntroduce getCityMessage(String city) {
		return cityDao.getCityMessage(city);
	}

	/**
	 * 添加评论城市
	 */
	@Override
	public boolean commentCity(CityIntroduceComment cityIntroduceComment) {
		return cityDao.commentCity(cityIntroduceComment);
	}

	/**
	 * 添加评论城市的照片
	 */
	@Override
	public boolean commentCityPhoto(CityIntroduceCommentPhoto cityIntroduceCommentPhoto) {
		return cityDao.commentCityPhoto(cityIntroduceCommentPhoto);
	}

	/**
	 * 根据城市id获取点赞数
	 */
	@Override
	public int getPraisenumber(Integer c_id) {
		return cityDao.getPraisenumber(c_id);
	}

	/**
	 * 回复评论
	 */
	@Override
	public boolean replyComment(CityIntroduceCommentReply cityIntroduceCommentReply) {
		return cityDao.replyComment(cityIntroduceCommentReply);
	}

	/**
	 * 点赞城市
	 */
	@Override
	public boolean praiseCity(CityIntroducePraise cityIntroducePraise) {
		return cityDao.praiseCity(cityIntroducePraise);
	}

	/**
	 * 城市介绍评论点赞表
	 */
	@Override
	public boolean commentPraise(CityIntroduceCommentPraise cityIntroduceCommentPraise) {
		return cityDao.commentPraise(cityIntroduceCommentPraise);
	}

	/**
	 * 获取评论点赞数
	 */
	@Override
	public int getCommentPraisenumber(Integer ccr_id) {
		return cityDao.getCommentPraisenumber(ccr_id);
	}

	/**
	 * 后台城市管理，添加城市
	 */
	@Override
	public boolean addCity(CityIntroduce cityIntroduce) {
		return cityDao.addCity(cityIntroduce);
	}

	/**
	 * 后台添加城市图片
	 */
	@Override
	public boolean addCityPhotos(CityIntroducePhoto cityIntroducePhoto) {
		return cityDao.addCityPhotos(cityIntroducePhoto);
	}

	/**
	 * 后台修改城市信息
	 */
	@Override
	public boolean updateCityById(CityIntroduce cityIntroduce) {
		return cityDao.updateCityById(cityIntroduce);
	}

	/**
	 * 后台修改城市图片
	 */
	@Override
	public boolean updateCityPhotos(CityIntroducePhoto cityIntroducePhoto) {
		return cityDao.updateCityPhotos(cityIntroducePhoto);
	}

	/**
	 * 后台批量删除城市
	 */
	@Override
	public boolean batchDelete(int[] c_id) {
		return cityDao.batchDelete(c_id);
	}

	/**
	 * 后台批量删除城市图片
	 */
	@Override
	public boolean batchDeletePhoto(String id) {
		return cityDao.batchDeletePhoto(id);
	}

	/**
	 * 后台查询所有城市列表
	 */
	@Override
	public List<CityIntroduce> selectCityIntroduce(String c_inprovince) {
		return cityDao.selectCityIntroduce(c_inprovince);
	}

	/**
	 * 查询是否点赞该评论
	 */
	@Override
	public CityIntroduceCommentPraise ifPraise(String userid) {
		return cityDao.ifPraise(userid);
	}

	/**
	 * 查询登录人是否点赞该城市
	 * 
	 */
	@Override
	public int ifPraiseCityToUserid(int c_id, String userid) {
		return cityDao.ifPraiseCityToUserid(c_id, userid);
	}
}
